/*
 * @Author: yangni 920556271@qq.com
 * @Date: 2023-12-07 09:26:03
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-02-28 18:10:47
 * @FilePath: /yt-devops/lib/pages/devices/device_add/scan_device_result/scan_device_result_model.dart
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import 'package:get/get.dart';
import 'package:yt_devops/model/info_item.dart';
import 'package:yt_devops/pages/devices/device_list/device_list_model.dart';
import 'package:yt_devops/resources/str_res_keys.dart';

class ScanDeviceResult extends DeviceListModel {
  ScanDeviceResult(
      {super.deviceId,
      super.productType,
      super.sn,
      super.model,
      super.productTypeName,
      super.name});

  @override
  List<InfoItem> get infos => [
        InfoItem(ResKey.deviceSn.tr, sn ?? ''),
        InfoItem(ResKey.productType.tr, productTypeName ?? ''),
        InfoItem(ResKey.productModel.tr, model?.toString() ?? ''),
      ];

  factory ScanDeviceResult.fromJson(Map<String, dynamic> json) =>
      ScanDeviceResult(
        name: json['name'] as String?,
        model: json['model'] as String?,
        deviceId: json['deviceId'] as int?,
        productType: json['productType'] as int?,
        productTypeName: json['productTypeName'] as String?,
        sn: json['sn'] as String?,
      );
}
